let mix = require('laravel-mix');

/*
 |--------------------------------------------------------------------------
 | Mix Asset Management
 |--------------------------------------------------------------------------
 |
 | Mix provides a clean, fluent API for defining some Webpack build steps
 | for your Laravel application. By default, we are compiling the Sass
 | file for the application as well as bundling up all the JS files.
 |
 */

function resolve (dir) {
    return path.join(__dirname, dir);
}

mix.js('resources/assets/js/app.js', 'public/js')
   .sass('resources/assets/sass/app.scss', 'public/css');


mix.webpackConfig({
    output: {
        publicPath: '/',
        chunkFilename: `js/webapp/chunk[name].[chunkhash].js`
    },
    externals: {
        "BMap": "BMap",
        "BMapLib": "BMapLib",
    },
    resolve: {
        extensions: ['.js', '.vue'],
        alias: {
            '@': resolve('resources/assets/js/webapp'),
        }
    }
}).js('resources/assets/js/webapp.js', 'public/js')
    .sass('resources/assets/sass/webapp.scss', 'public/css/');


mix.version();

if (!mix.config.inProduction) {
    mix.browserSync({
        proxy: 'www.cdb.com',
        host: 'www.cdb.com',
        open: false,
        notify: false
    });
}

mix.disableNotifications();
